package com.anxin.act.busFlow.entity;

import com.alibaba.fastjson.JSONArray;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.anxin.framework.aspectj.lang.annotation.Excel;
import com.anxin.framework.web.entity.BaseEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * 业务流程节点对象 wf_config_node
 *
 * @author jbs
 * @date 2020-04-08
 */
//@ApiModel(description = "业务流程节点")
public class WfConfigNode extends BaseEntity<WfConfigNode>{
    private static final long serialVersionUID = 1L;

    /** 主键ID */
    //@ApiModelProperty(value = "主键ID",position=10)
    private String id;

    //@ApiModelProperty(value = "关联的流程配置ID",position=11)
    private String flowId;

    /** 父节点ID */
    //@ApiModelProperty(value = "父节点ID",position=20)
    private String parentId;

    /** 节点名称 */
    //@ApiModelProperty(value = "节点名称",position=30)
    private String nodeName;

    /** 表单类型 */
    //@ApiModelProperty(value = "表单类型",position=40)
    private String formType;

    /** 表单ID */
    //@ApiModelProperty(value = "表单ID",position=50)
    private String formId;

    /** 表单ID */
    //@ApiModelProperty(value = "流程节点增加是否需要操作按钮配置",position=50)
    private String operation;

    //@ApiModelProperty(value = "表单名称",position=50)
    private String formName;

    /** 对应流程 */
    //@ApiModelProperty(value = "对应流程",position=60)
    private String processKey;

    /** 审批完成后是否发起会议，Y:是，N:否 */
    //@ApiModelProperty(value = "审批完成后是否发起会议，Y:是，N:否",position=70)
    private String meeting;

    /** 会议类型 */
    //@ApiModelProperty(value = "会议类型",position=80)
    private String meetingType;

    /** 可以查看节点的角色 */
    //@ApiModelProperty(value = "可以查看节点的角色",position=90)
    private JSONArray viewRole;

    //@ApiModelProperty(value = "可以查看节点的角色名称",position=90)
    private String viewRoleName;

    /** 可以启动流程的角色 */
    //@ApiModelProperty(value = "可以启动流程的角色",position=100)
    private JSONArray startRole;

    //@ApiModelProperty(value = "可以启动流程的角色名称",position=100)
    private String startRoleName;

    /** 可以启动流程的部门 */
    //@ApiModelProperty(value = "可以启动流程的部门",position=110)
    private JSONArray startDept;

    //@ApiModelProperty(value = "可以启动流程的部门",position=110)
    private String startDeptName;

    /** 可以豁免流程的部门 */
    //@ApiModelProperty(value = "可以豁免流程的角色",position=120)
    private JSONArray immunityRole;

    /** 可以豁免流程的部门 */
    //@ApiModelProperty(value = "客户编辑节点的角色",position=120)
    private JSONArray editRole;

    //@ApiModelProperty(value = "可以豁免流程的角色名称",position=120)
    private String immunityRoleName;

    /**
     * 流程附件校验
     */
    //@ApiModelProperty(value = "流程依赖节点",position=120)
    private JSONArray relyNode;

    //@ApiModelProperty(value = "流程依赖节点名称",position=120)
    private String relyNodeName;

    /** 什么状态下可以再次启动 */
    //@ApiModelProperty(value = "什么状态下可以再次启动",position=130)
    private JSONArray restart;

    /** 启动前校验的附件 */
    //@ApiModelProperty(value = "启动前校验的附件",position=140)
    private JSONArray checkFile;

    //@ApiModelProperty(value = "启动前校验的附件名称",position=140)
    private String checkFileName;

    /** 选填附件 */
    //@ApiModelProperty(value = "选填附件",position=150)
    private JSONArray optionalFile;

    //@ApiModelProperty(value = "选填附件名称",position=150)
    private String optionalFileName;

    //@ApiModelProperty(value = "节点类型",position=150)
    private String nodeType;

    /**
     * 是否从文档库自动带出附件，Y:是，N:否
     */
    //@ApiModelProperty(value = "是否从文档库自动带出附件，Y:是，N:否",position=160)
    private String bringAccessories;

    /** 审批完成后是否进入投后，Y:是，N:否 */
    //@ApiModelProperty(value = "审批完成后是否进入投后，Y:是，N:否",position=170)
    private String after;

    //@ApiModelProperty(value = "排序字段",position=180)
    private Long sort;

    //@ApiModelProperty(value = "所属业务阶段",position=180)
    private String busStatus;

    //@ApiModelProperty(value = "流程审批完成后跳转阶段",position=180)
    private String jumpStage;

    // 增加配置提醒相关字段
    // 提醒状态
    private String status;
    // 提醒标题
    private String reminderTitle;
    // 提醒方式
    private JSONArray reminderMode;
    // 是否提醒团队成员
    private String isReminderTeamMembers;
    // 其他提醒角色
    private String otherReminderRoles;
    // 其他提醒用户
    private JSONArray otherReminderUser;
    // 提醒频率
    private JSONArray reminderFrequency;
    // 提醒内容
    private String reminderContent;
    // 关键字列表
    private List<ConfigNodeKeyword> configNodeKeywordList;

    public JSONArray getEditRole() {
        return editRole;
    }

    public void setEditRole(JSONArray editRole) {
        this.editRole = editRole;
    }

    public List<ConfigNodeKeyword> getConfigNodeKeywordList() {
        return configNodeKeywordList;
    }

    public void setConfigNodeKeywordList(List<ConfigNodeKeyword> configNodeKeywordList) {
        this.configNodeKeywordList = configNodeKeywordList;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getReminderTitle() {
        return reminderTitle;
    }

    public void setReminderTitle(String reminderTitle) {
        this.reminderTitle = reminderTitle;
    }

    public JSONArray getReminderMode() {
        return reminderMode;
    }

    public void setReminderMode(JSONArray reminderMode) {
        this.reminderMode = reminderMode;
    }

    public String getIsReminderTeamMembers() {
        return isReminderTeamMembers;
    }

    public void setIsReminderTeamMembers(String isReminderTeamMembers) {
        this.isReminderTeamMembers = isReminderTeamMembers;
    }

    public String getOtherReminderRoles() {
        return otherReminderRoles;
    }

    public void setOtherReminderRoles(String otherReminderRoles) {
        this.otherReminderRoles = otherReminderRoles;
    }

    public JSONArray getOtherReminderUser() {
        return otherReminderUser;
    }

    public void setOtherReminderUser(JSONArray otherReminderUser) {
        this.otherReminderUser = otherReminderUser;
    }

    public JSONArray getReminderFrequency() {
        return reminderFrequency;
    }

    public void setReminderFrequency(JSONArray reminderFrequency) {
        this.reminderFrequency = reminderFrequency;
    }

    public String getReminderContent() {
        return reminderContent;
    }

    public void setReminderContent(String reminderContent) {
        this.reminderContent = reminderContent;
    }

    public JSONArray getRelyNode() {
        return relyNode;
    }

    public void setRelyNode(JSONArray relyNode) {
        this.relyNode = relyNode;
    }

    public String getFormName() {
        return formName;
    }

    public void setFormName(String formName) {
        this.formName = formName;
    }

    public Long getSort() {
        return sort;
    }

    public void setSort(Long sort) {
        this.sort = sort;
    }

    // 子级节点
    private List<WfConfigNode> children;

    public void setId(String id){
        this.id = id;
    }

    public String getId(){
        return id;
    }
    public void setParentId(String parentId){
        this.parentId = parentId;
    }

    public String getParentId(){
        return parentId;
    }
    public void setNodeName(String nodeName){
        this.nodeName = nodeName;
    }

    public String getNodeName(){
        return nodeName;
    }
    public void setFormType(String formType){
        this.formType = formType;
    }

    public String getFormType(){
        return formType;
    }
    public void setFormId(String formId){
        this.formId = formId;
    }

    public String getFormId(){
        return formId;
    }
    public void setProcessKey(String processKey){
        this.processKey = processKey;
    }

    public String getProcessKey(){
        return processKey;
    }
    public void setMeeting(String meeting){
        this.meeting = meeting;
    }

    public String getMeeting(){
        return meeting;
    }
    public void setMeetingType(String meetingType){
        this.meetingType = meetingType;
    }

    public String getMeetingType(){
        return meetingType;
    }

    public void setViewRole(JSONArray viewRole) {
        this.viewRole = viewRole;
    }

    public void setStartRole(JSONArray startRole) {
        this.startRole = startRole;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public JSONArray getViewRole() {
        return viewRole;
    }

    public JSONArray getStartRole() {
        return startRole;
    }

    public JSONArray getStartDept() {
        return startDept;
    }

    public JSONArray getImmunityRole() {
        return immunityRole;
    }

    public JSONArray getRestart() {
        return restart;
    }

    public JSONArray getCheckFile() {
        return checkFile;
    }

    public void setStartDept(JSONArray startDept) {
        this.startDept = startDept;
    }

    public void setImmunityRole(JSONArray immunityRole) {
        this.immunityRole = immunityRole;
    }

    public void setRestart(JSONArray restart) {
        this.restart = restart;
    }

    public void setCheckFile(JSONArray checkFile) {
        this.checkFile = checkFile;
    }

    public void setAfter(String after){
        this.after = after;
    }

    public String getAfter(){
        return after;
    }

    public String getFlowId() {
        return flowId;
    }

    public void setFlowId(String flowId) {
        this.flowId = flowId;
    }

    public List<WfConfigNode> getChildren() {
        return children;
    }

    public void setChildren(List<WfConfigNode> children) {
        this.children = children;
    }

    public String getViewRoleName() {
        return viewRoleName;
    }

    public void setViewRoleName(String viewRoleName) {
        this.viewRoleName = viewRoleName;
    }

    public String getStartRoleName() {
        return startRoleName;
    }

    public void setStartRoleName(String startRoleName) {
        this.startRoleName = startRoleName;
    }

    public String getImmunityRoleName() {
        return immunityRoleName;
    }

    public void setImmunityRoleName(String immunityRoleName) {
        this.immunityRoleName = immunityRoleName;
    }

    public String getStartDeptName() {
        return startDeptName;
    }

    public String getRelyNodeName() {
        return relyNodeName;
    }

    public void setRelyNodeName(String relyNodeName) {
        this.relyNodeName = relyNodeName;
    }

    public String getCheckFileName() {
        return checkFileName;
    }

    public void setCheckFileName(String checkFileName) {
        this.checkFileName = checkFileName;
    }

    public void setStartDeptName(String startDeptName) {
        this.startDeptName = startDeptName;
    }

    public String getBusStatus() {
        return busStatus;
    }

    public void setBusStatus(String busStatus) {
        this.busStatus = busStatus;
    }

    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public JSONArray getOptionalFile() {
        return optionalFile;
    }

    public void setOptionalFile(JSONArray optionalFile) {
        this.optionalFile = optionalFile;
    }

    public String getOptionalFileName() {
        return optionalFileName;
    }

    public void setOptionalFileName(String optionalFileName) {
        this.optionalFileName = optionalFileName;
    }

    public String getBringAccessories() {
        return bringAccessories;
    }

    public String getNodeType() {
        return nodeType;
    }

    public void setNodeType(String nodeType) {
        this.nodeType = nodeType;
    }

    public void setBringAccessories(String bringAccessories) {
        this.bringAccessories = bringAccessories;
    }

    public String getJumpStage() {
        return jumpStage;
    }

    public void setJumpStage(String jumpStage) {
        this.jumpStage = jumpStage;
    }

    public void addChildren(List<WfConfigNode> nodeList){
        if (this.children == null){
            children = new ArrayList<>();
        }
        for (WfConfigNode wfConfigNode : nodeList) {
            if (this.id.equals(wfConfigNode.getParentId())){
                children.add(wfConfigNode);
            }
        }
    }


}
